package com.hainatong.shiphelper.module.workermgr.adapter;


import com.hainatong.shiphelper.databinding.ItemWorkerJobViewBinding;

import com.hainatong.shiphelper.module.workermgr.entity.WorkerBean;
import com.hainatong.shiphelper.utils.GlideUtil;
import org.jetbrains.annotations.NotNull;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseDataBindingHolder;
import com.hainatong.shiphelper.R;


public class WorkerAdapter extends BaseQuickAdapter<WorkerBean, BaseDataBindingHolder<ItemWorkerJobViewBinding>>
{
    public WorkerAdapter()
    {
        super(R.layout.item_worker_job_view);
    }

    @Override
    protected void convert(@NotNull BaseDataBindingHolder<ItemWorkerJobViewBinding> bindingHolder, WorkerBean workerBean)
    {
        ItemWorkerJobViewBinding binding = bindingHolder.getDataBinding();
        if( binding != null )
        {
            binding.tvWorkerName.setText( workerBean.getUserName() );
            binding.tvWorkerJob.setText( workerBean.getRoleName() );

            GlideUtil.displayCircle(binding.ivUserHeader , workerBean.getHeadImageUrl()  );
            binding.setWorker( workerBean );
            binding.executePendingBindings();
        }
    }
}
